import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class DeleteChipDemo extends StatefulWidget {
  const DeleteChipDemo({Key? key}) : super(key: key);

  @override
  _DeleteChipDemoState createState() => _DeleteChipDemoState();
}

class _DeleteChipDemoState extends State<DeleteChipDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("带删除功能的Chip"),
      ),
      body: Center(
        child: Chip(
          label: Text("City"),
          onDeleted: () {
            Fluttertoast.showToast(msg: "准备删除");
          },
          deleteIcon: Icon(Icons.close),
          deleteIconColor: Colors.redAccent,
          deleteButtonTooltipMessage: 'remove a msg',
        ),
      ),
    );
  }
}
